import sys
file_name = sys.argv[1]
mol_name = sys.argv[2]

f = open(file_name,"r")
f_lines = [i for i in f]
f.close()
for i in range(len(f_lines)):
    # print(f_lines[i][17:20])
    if f_lines[i][17:20] == mol_name:
        f_lines[i] = "HETATM" + f_lines[i][6:-1] + f_lines[i][-1]

f2 = open(file_name.split(".")[0] + "repair." + file_name.split(".")[1],"w+")
f2.writelines(f_lines)
f2.close()
